package com.yy.net 
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	
	import com.shengyu.maqie.model.data.RoomList;
	import com.shengyu.maqie.model.data.RoomData;
	
	import com.yy.net.event.PHPEvent;
	import com.yy.net.phpclass.*;
	import com.yy.net.event.EventCenter;
	
	import com.maqie.GlobalConfig;
	import com.maqie.debug.Debug;
	
	
	/**
	 * 读取完成
	 * @eventType flash.events.Event.COMPLETE
	 */
	[Event(name="complete", type="flash.events.Event")] 
	
	/**
	 * @author jj043
	 */
	public class ReadRoomData extends EventDispatcher 
	{
		
		
		/**
		 * 读取完成事件
		 */
		[Event(name = "complete", type = "flash.events.Event")];
		
		
		//数据数组
		private var _data:Array = new Array();
		/**
		 * 构造
		 */
		public function ReadRoomData() 
		{
			
		}
		
		
		/**
		 * 读取房间数据
		 */
		public function readGameList():void
		{
			if (GlobalConfig.PHPDebug)
			{
				onGetRoomList();
			}
			else
			{
			   //请求php接口
			}
		}
		private function onGetRoomList(e:PHPEvent=null):void
		{
			if (e)
			{
				//php端返回数据
			}
			else
			{
				var tempArray:Array = new Array('1', '我的天啦', '5', '3', '9', '2', '100', '500', '123', '192.168.0.5', '8024');
				tempRoomData = new RoomData();
				tempRoomData.setTableInfo(tempArray);
				RoomList.getRoomList().addData(tempRoomData);
				tempArray = null;
				tempRoomData = null;
			}
			dispatchEvent(new Event(Event.COMPLETE));
		}
		
				
		/// 完成
		private function complete():void
		{
			dispatchEvent(new Event(Event.COMPLETE));
		}
		
	}
	
}